Skip to content

Add ZKVerifier and ZKProver for zero-knowledge binius64 proofs#1448

Merged
jimpo merged 9 commits intomainfrom
zk-verifier-prover
Apr 9, 2026
Merged

Add ZKVerifier and ZKProver for zero-knowledge binius64 proofs#1448
jimpo merged 9 commits intomainfrom
zk-verifier-prover

Conversation

@jimpo
Copy link
Copy Markdown
Collaborator

@jimpo jimpo commented Apr 9, 2026

Summary

  • Extract IOPVerifier / IOPProver from Verifier / Prover to separate IOP logic from the BaseFold compilation layer
  • Generalize IOPVerifier::verify over Channel::Elem (not just Elem = B128) to enable symbolic execution through IronSpartanBuilderChannel
  • Remove binius-verifier / binius-prover dependencies from spartan crates (replace with direct deps on binius-iop, binius-ip, binius-hash)
  • Add binius_verifier::zk_config::ZKVerifier and binius_prover::zk_config::ZKProver that wrap the binius64 IOP with a Spartan-based ZK wrapper
  • Generalize ZKWrappedProverChannel to accept a ReplayFn closure instead of holding an IOPVerifier, eliminating protocol-specific channel duplicates
  • Add From<B128> for CircuitElem to support the generalized IOPVerifier::verify bound

Test plan

  • cargo test -p binius-prover --test prove_verify — runs both non-ZK and ZK SHA256 round-trips
  • cargo test -p binius-spartan-prover --test wrapper_integration_test — spartan ZK wrapper test with generalized channel

jimpo added 8 commits April 9, 2026 12:05
Separate the IOP-level verification logic from the compilation layer by
introducing an IOPVerifier struct. IOPVerifier holds the constraint system
and log_public_words, and provides the core verify() method that operates
on an abstract IOPVerifierChannel. Verifier becomes a thin wrapper that
composes IOPVerifier with a BaseFoldVerifierCompiler.

This follows the same separation pattern used in the spartan-verifier
crate, where IOPVerifier is independent of the specific IOP compilation
strategy (BaseFold, etc.).
Separate the IOP-level proving logic from the compilation layer by
introducing an IOPProver struct. IOPProver holds the constraint system,
derived size parameters, and the KeyCollection, and provides the core
prove() method that operates on an abstract IOPProverChannel with the
packed field type P as a method-level generic parameter.

Prover becomes a thin wrapper that composes IOPProver with a
BaseFoldProverCompiler, mirroring the IOPVerifier/Verifier separation
in the verifier crate and the same pattern used in spartan-prover.
Replace the binius-verifier dependency with direct imports from the
underlying crates (binius-iop, binius-ip, binius-hash). This removes
a potential circular dependency, since binius-verifier re-exported
these types purely for convenience.

Also remove binius-verifier from binius-spartan-prover dependencies
(only used in dev-dependencies for tests).
Replace the inner_verifier field with a generic ReplayFn closure parameter.
The closure is called during finish() with a ReplayChannel to replay the
inner verification and fill the outer witness. This makes the channel
generic over different inner verification protocols.

Also adds binius_prover::zk_config::ZKProver which uses the generalized
channel with a closure that calls binius IOPVerifier::verify for replay.
Add test_zk_prove_verify_sha256_preimage that exercises the full ZK
round-trip: ZKVerifier::setup, ZKProver::setup, prove, verify using
the SHA256 compression circuit.
All new binius crate dependencies introduced in this PR should use
default-features = false, with rayon features wired up through
dependent feature flags. Also applies the same pattern to
binius-spartan-prover's existing dependencies.
@jimpo jimpo force-pushed the zk-verifier-prover branch from 59ef574 to 85a197d Compare April 9, 2026 18:40
In the non-rayon mock, core::iter::repeat_n returns a std::iter::RepeatN
which doesn't implement ParallelIterator. Wrap it in a ParallelWrapper
so it works with the mock parallel iterator chain methods.
@jimpo jimpo merged commit 0bf3a9a into main Apr 9, 2026
15 checks passed
@jimpo jimpo deleted the zk-verifier-prover branch April 9, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant